home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / sys5 / iscwmpst.z / iscwmpst / tcp / src / mbuf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-25  |  2.1 KB  |  62 lines

  1. /* @(#) $Header: mbuf.h,v 1.4 91/02/24 20:17:19 deyke Exp $ */
  2.  
  3. #ifndef _MBUF_H
  4. #define _MBUF_H
  5.  
  6. #include <stdio.h>
  7.  
  8. #ifndef _GLOBAL_H
  9. #include "global.h"
  10. #endif
  11.  
  12. /* Basic message buffer structure */
  13. struct mbuf {
  14.     struct mbuf *next;      /* Links mbufs belonging to single packets */
  15.     struct mbuf *anext;     /* Links packets on queues */
  16.     int16 size;             /* Size of associated data buffer */
  17.     int refcnt;             /* Reference count */
  18.     struct mbuf *dup;       /* Pointer to duplicated mbuf */
  19.     char *data;             /* Active working pointers */
  20.     int16 cnt;
  21. };
  22. #define NULLBUF (struct mbuf *)0
  23. #define NULLBUFP (struct mbuf **)0
  24.  
  25. #define PULLCHAR(bpp)\
  26.  ((bpp) != NULL && (*bpp) != NULLBUF && (*bpp)->cnt > 1 ? \
  27.  ((*bpp)->cnt--,(unsigned char)*(*bpp)->data++) : pullchar(bpp))
  28.  
  29. /* In mbuf.c: */
  30. void enqueue __ARGS((struct mbuf **q,struct mbuf *bp));
  31. void append __ARGS((struct mbuf **bph,struct mbuf *bp));
  32. void free_q __ARGS((struct mbuf **q));
  33. void trim_mbuf __ARGS((struct mbuf **bpp,int length));
  34. struct mbuf *alloc_mbuf __ARGS((int size));
  35. struct mbuf *ambufw __ARGS((int size));
  36. struct mbuf *free_mbuf __ARGS((struct mbuf *bp));
  37. struct mbuf *dequeue __ARGS((struct mbuf **q));
  38. struct mbuf *copy_p __ARGS((struct mbuf *bp,int cnt));
  39. struct mbuf *free_p __ARGS((struct mbuf *bp));
  40. struct mbuf *qdata __ARGS((char *data,int cnt));
  41. struct mbuf *pushdown __ARGS((struct mbuf *bp,int size));
  42. int16 pullup __ARGS((struct mbuf **bph,char *buf,int cnt));
  43. int16 dup_p __ARGS((struct mbuf **hp,struct mbuf *bp,int offset,int cnt));
  44. int16 len_p __ARGS((struct mbuf *bp));
  45. int16 dqdata __ARGS((struct mbuf *bp,char *buf,unsigned cnt));
  46. int16 len_q __ARGS((struct mbuf *bp));
  47. int32 pull32 __ARGS((struct mbuf **bpp));
  48. int32 get32 __ARGS((char *cp));
  49. long pull16 __ARGS((struct mbuf **bpp));
  50. void refiq __ARGS((void));
  51. void mbuf_crunch __ARGS((struct mbuf **bpp));
  52. int16 get16 __ARGS((char *cp));
  53. int pullchar __ARGS((struct mbuf **bpp));
  54. char *put16 __ARGS((char *cp,int x));
  55. char *put32 __ARGS((char *cp,int32 x));
  56. int write_p __ARGS((FILE *fp,struct mbuf *bp));
  57. void iqstat __ARGS((void));
  58.  
  59. #define AUDIT(bp)       audit(bp,__FILE__,__LINE__)
  60.  
  61. #endif  /* _MBUF_H */
  62.